![]() ![]() |
Q
I'm writing a backup program and I'd like to find the VM Storage file, so as to avoid
backing it up.
How do I do this?
A The best way of finding the current VM Storage file is to use a previously undocumented Gestalt selector: enum { gestaltVMBackingStoreFileRefNum = 'vmbs' }; The result of this selector is an file reference number to the active "VM Storage" file.
You can convert that reference number to an FSSpec by calling OSErr FindVMStorage(FSSpec *fss) { OSErr err; long gestaltResult; FCBPBRec fcbPB; Str255 theName; err = Gestalt(gestaltVMBackingStoreFileRefNum, &gestaltResult); if (err == noErr) { fcbPB.ioNamePtr = theName; fcbPB.ioVRefNum = 0; fcbPB.ioRefNum = gestaltResult; fcbPB.ioFCBIndx = 0; err = PBGetFCBInfoSync(&fcbPB); if (err == noErr) { err = FSMakeFSSpec(fcbPB.ioFCBVRefNum, fcbPB.ioFCBParID, theName, fss); } } return err; } [Mar 30 2001] |
Developer Documentation | Technical Notes | Development Kits | Sample Code |